﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DevDL.UserLimit.IDAL;
using DevDL.UserLimit.DALFactory;
using DevDL.UserLimit.Models;

namespace DevDL.UserLimit.BLL
{
    public class RoleBLL
    {
        IRoleDAL iroleDAL = DataAccess.CreateRoleDAL();
        public int AddRole(Role role)
        {
            return iroleDAL.AddRole(role);
        }

        public DataSet GetRoles()
        {
            return iroleDAL.GetRoles();
        }

        public int UpdateRoleDataSet(DataSet ds, int tableIndex)
        {
            return iroleDAL.UpdateRoleDataSet(ds, 0);
        }

        public int Insert(Role role)
        {
            return iroleDAL.Insert(role);
        }

        public int Update(Role role)
        {
            return iroleDAL.Update(role);
        }

        public int Delete(int id)
        {
            return iroleDAL.Delete(id);
        }
        public int UpdateFunction(Models.Role role)
        {
            return iroleDAL.UpdateFunction(role);
        }
        /// <summary>
        /// 根据编号查询功能
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetFunctionById(int id)
        {
            return iroleDAL.GetFunctionById(id);
        }
        /// <summary>
        /// 根据操作员编号查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetFunctionByOperatorId(int id)
        {
            return iroleDAL.GetFunctionByOperatorId(id);
        }
    }
}
